package com.ehotting.eaf.netty.client;

import com.ehotting.eaf.netty.exception.StateConstants;

import java.util.Collection;

public class MultiTcpClientHelper {

    public static String checkChannelIdValid(String channelId,Collection<TcpClient> tcpClientList){
        String state = StateConstants.CHANNEL_INACTIVE;
        for(TcpClient  tcpClient : tcpClientList){
            if(tcpClient.getChannel()!=null
                    && tcpClient.getChannel().isActive()
                    && tcpClient.getChannel().id().asLongText().equals(channelId)){
                state = StateConstants.SUCCESS;
            }
        }
        return state;
    }

}
